/*
 *    This file is part of SSHTunneler.
 *
 *    Copyright 2009 Jean-Sebastien Gelinas <calestar@gmail.com>
 *
 *    SSHTunneler is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    SSHTunneler is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with SSHTunneler.  If not, see <http://www.gnu.org/licenses/>.
 *
 */
package sshtunneler.server_tunnel.tree;

import javax.swing.JPopupMenu;

import sshtunneler.library.Server;
import sshtunneler.library.Tunnel;

public abstract class GenericServerTunnelTree {
	public abstract JPopupMenu get_server_menu();

	public abstract JPopupMenu get_root_menu();

	public abstract JPopupMenu get_tunnel_menu();

	public abstract Server create_server(String username, String hostname,
			int port);

	public abstract void process_server_action(boolean added, boolean deleted,
			boolean modified);

	public abstract void process_tunnel_action(boolean added, boolean deleted,
			boolean modified);

	private Server selected_server;
	private Tunnel selected_tunnel;
	private MyServerTunnelTreeNode selected_node;

	public JPopupMenu get_server_menu(Server server, MyServerTunnelTreeNode node) {
		this.selected_tunnel = null;
		this.selected_server = server;
		this.selected_node = node;

		return this.get_server_menu();
	}

	public JPopupMenu get_tunnel_menu(Server server, Tunnel tunnel,
			MyServerTunnelTreeNode node) {
		this.selected_tunnel = tunnel;
		this.selected_server = server;
		this.selected_node = node;

		return this.get_tunnel_menu();
	}

	public Tunnel getSelected_tunnel() {
		return this.selected_tunnel;
	}

	public Server getSelected_server() {
		return this.selected_server;
	}

	public MyServerTunnelTreeNode getSelected_node() {
		return this.selected_node;
	}

	public JPopupMenu get_root_menu(MyServerTunnelTreeNode node) {
		this.selected_tunnel = null;
		this.selected_server = null;
		this.selected_node = node;

		return this.get_root_menu();
	}
}
